﻿using System;

namespace CardPlay.Model.GameModel.Actions
{
    public abstract class PileAction : GameAction, IPileAction
    {
        protected PileAction(CardGame cardGame, PartLocation location) : base(cardGame, location)
        {
            Guard.Against<ArgumentException>(SourcePile == null, "Pile");
        }

        public CardPile SourcePile
        {
            get { return CardGame.PileAt(Location); }
        }
        
        public CardPile TopPile
        {
            get { return SourcePile.TopPile(Location.Index); }
        }
    }
}
